﻿using System;
using System.IO;

namespace LabSolutions
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            string[] inputNumbers = input.Split(' ');
            double x = double.Parse(input);
            double value =
                x > 5 ? Line(5, 0, 7, -1, x) :
                x > 1 ? Circle(3, 0, 2, x, true) :
                x > -1 ? 0 :                
                x >= -3 ? Line(-2, 1, -1, 0, x) :
                double.NaN;

            Console.Write(value.ToString("0.00000"));            
        }

        private static double Circle(double x0, double y0, double radius, double x, bool higher)
        {
            return y0 + (higher ? 1 : -1) * Math.Sqrt(Math.Pow(radius, 2) - Math.Pow(x - x0, 2));
        }

        private static double Line(double x1, double y1, double x2, double y2, double x)
        {
            return y1 + (y2 - y1) * (x - x1) / (x2 - x1);
        }
    }
}
